package com.nuanshui.heatedloan.fund.integration.accountbill;

import com.alibaba.dubbo.config.annotation.Reference;
import com.nuanshui.heatedloan.constant.GlobalParam;
import com.nuanshui.heatedloan.fund.facade.UserAccountBillService;
import com.nuanshui.heatedloan.fund.facade.UserBindAccountService;
import com.nuanshui.heatedloan.fund.model.UserAccount;
import com.nuanshui.heatedloan.fund.model.UserAccountBill;
import com.nuanshui.heatedloan.userinfo.facade.UserQueryService;
import com.nuanshui.heatedloan.userinfo.model.User;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * 账单门面
 * 
 * @param 
 * @author guohao
 * @date 2017年1月11日 下午3:14:34  
 * @since $
 */@Component
public class AccountBillFacade {
	
	@Reference(url=GlobalParam.FUND_DUBBO_SERVER,timeout=GlobalParam.DUBBO_SERVER_TIME_OUT,version=GlobalParam.FUND_DUBBO_SERVER_VERSION)
	private UserAccountBillService userAccountBillService;
	@Reference(url=GlobalParam.FUND_DUBBO_SERVER,timeout=GlobalParam.DUBBO_SERVER_TIME_OUT,version=GlobalParam.FUND_DUBBO_SERVER_VERSION)
	private UserBindAccountService userBindAccountService;
	@Reference(url=GlobalParam.USER_DUBBO_SERVER,timeout=GlobalParam.DUBBO_SERVER_TIME_OUT,version = GlobalParam.USER_DUBBO_SERVER_VERSION)
	private UserQueryService userQueryService;
	/**
	 * 获取订单详情
	 * @param @return
	 * @author guohao
	 * @date 2017年1月11日 下午3:15:57
	 * @since $
	 */
	 public HashMap<String,Object> getAccountDetail(String  billId) {
		 UserAccountBill bill = userAccountBillService.findBillDetail(billId);
	     UserAccount ua = userBindAccountService.loadPayAccountById(bill.getBizId());
	     
	     User user =  userQueryService.load(bill.getUserId());
	     
	     bill.setUserName(user.getUsername());
	     bill.setUserNick(user.getNick());
	     HashMap<String, Object> map = new HashMap<String, Object>();
	     HashMap<String,Object> extParam = new HashMap<String, Object>();
	     map.put("bill", bill);
	     map.put("account", ua);
	     map.put("extParam",extParam);
	     
	     return map;
	 }
	 
	
	

}

